<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        function __mix__(obj1, obj2) {
            for (var k in obj2) {
                obj1[k] = obj2[k];
            }
        }
        var a = {
            name: '老周',
            age: 18
        }

        var b = {
            sex: '男'
        }

        __mix__(b, a);
        console.log(b);

        var o = {
            extend: function (obj) {
                for (var k in obj) {
                    this[k] = obj[k];
                }
            }
        }
        o.extend(a);
        console.log(o);







    </script>
</body>

</html>